import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * @author zack
 * @create 2019-08-02-19:29
 */

public class Test4_8_10 {
    public static void main(String[] args) {
        Set<Integer> set = new HashSet<>();
        int calc, sum = 0;
        for (int i = 10; i < 100; i++) {
            for (int j = 10; j < 100; j++) {
                calc = i * j;
                if (calc >= 1001 && calc <= 9999) {
                    String[] str1 = String.valueOf(calc).split("");
                    String[] str2 = (String.valueOf(i) + String.valueOf(j)).split("");
                    Arrays.sort(str1);
                    Arrays.sort(str2);
                    if (Arrays.equals(str1, str2)) {
                        set.add(calc);
                       // System.out.println(calc);
                    }
                }
            }
        }
        Iterator iterator = set.iterator();
        while (iterator.hasNext()) {
            int x = (int) iterator.next();
            System.out.println(x);
        }
    }
}